<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
      <el-form-item label="被取保候审人(被行政拘留人)" prop="hsr">
        <el-input v-model="queryParams.hsr" placeholder="请输入被取保候审人(被行政拘留人)" clearable @keyup.enter.native="handleQuery" />
      </el-form-item>
    <el-form-item label="案件编号">
      <el-input v-model="queryParams.ajbh" placeholder="请输入案件编号" clearable @keyup.enter.native="handleQuery" />
    </el-form-item>
      <!-- <el-form-item label="审核状态" prop="msshzt">
          <el-select v-model="queryParams.msshzt" clearable  placeholder="请选择审核状态">
              <el-option
              v-for="item in options"
              :key="item.msshzt"
              :label="item.label"
              :value="item.msshzt">
              </el-option>
          </el-select>
        </el-form-item> -->
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
  <el-form-item>
    <el-radio-group v-model="queryParams.sqshzt">  
    <el-radio label="1" @change="handleQuery">待审核</el-radio>
    <el-radio label="2" @change="handleQuery">已审核</el-radio>
    </el-radio-group>
  </el-form-item>
    </el-form>
    <!-- <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <div style="margin-top: 5px;">
          <el-col :span="1.5">
            <el-button type="success" plain icon="el-icon-success" size="mini" :disabled="!form.ajmc" @click="handleSuccess" >通过</el-button>
            <el-button type="danger" plain icon="el-icon-error" size="mini" :disabled="!form.ajmc" @click="handleBack" >退回</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button type="success" plain icon="el-icon-upload" size="mini" :disabled="!form.xh" @click="handleYwbj">业务办结</el-button>
          </el-col>
        </div>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row> -->

    <el-table v-loading="loading" height="650" :data="bzjtableList" :row-class-name="tableRowClassName" @current-change="tableCurrentChange" @row-dblclick="doubleclick">
      <el-table-column label="序号" align="center" prop="xh" />
      <el-table-column label="审核状态" align="center" width="150">
          <template slot-scope="scope">
              <el-tag :type="`${scope.row.sqshzt == 1 ? 'danger' : scope.row.sqshzt == 2 ? 'success' : ''}`">{{ scope.row.sqshzt == 1 ?
                  `待审核` : scope.row.sqshzt == 2 ? `已审核` : ''}}</el-tag>
          </template>
      </el-table-column>
      <el-table-column label="案件编号" align="center" prop="ajbh" />
      <el-table-column label="案件名称" align="center" prop="ajmc" />
      <el-table-column label="收取法律文书号" align="center" prop="sqwsh" width="180" />
      <!-- <el-table-column label="票据编号" align="center" prop="billNo" width="120" /> -->
      <el-table-column label="取保候审人" align="center" prop="hsr" width="120" />
      <el-table-column label="行政拘留人" align="center" prop="xjr" width="120" />
      <el-table-column label="性别" align="center" prop="xb" width="55" />
      <el-table-column label="出生日期" align="center" prop="csrq" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.csrq, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <!-- <el-table-column label="住址" align="center" prop="zz" width="220" /> -->
      <el-table-column label="户籍户籍地址" align="center" prop="hjdz" />
      <!-- <el-table-column label="单位及职务" align="center" prop="dwzw" width="120" /> -->
      <el-table-column label="联系电话" align="center" prop="lxdh" width="120" />
      <el-table-column label="身份证号" align="center" prop="sfzh" width="200" />
      <el-table-column label="案件性质" align="center" prop="ajxz" width="180" />
      <el-table-column label="保证金金额" align="center" prop="sqje" width="120" />
      <el-table-column label="收费方式" align="center" prop="sqfs" />
      <el-table-column label="填报人" align="center" prop="sqtfr" />
      <el-table-column label="填报时间" align="center" prop="sqtfsj" width="180" />
      <!-- <el-table-column label="批准人" align="center" prop="pzr" /> -->
      <el-table-column label="批准时间" align="center" prop="pzsj" width="180" />
      <el-table-column label="办案人" align="center" prop="bar" />
      <el-table-column label="办案人" align="center" prop="sq_barlxdh" />
      <!-- <el-table-column label="办案人所在单位编号" align="center" prop="dwbh" width="180"/> -->
      <el-table-column label="办案单位" align="center" prop="badw" />
      <el-table-column label="填报时间" align="center" prop="sqtfsj" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.sqtfsj, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
    </el-table>
    <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
    <el-dialog :visible.sync="pdfs" width="45%">
         <div style="display: flex;align-items: center;justify-content: center;">
          <img :src="this.pdfUrl" alt width="80%" />
         </div>
    </el-dialog>
    <el-dialog title="查看附件" :visible.sync="dialogFormVisible">
      <el-table height="600" border :data="fileList" :header-cell-style="{ backgroundColor: 'rgb(237 237 237)'}">
        <el-table-column label="文件名称" prop="fjmc" />
        <el-table-column label="环节" prop="lb" />
        <el-table-column label="文件类型" prop="wjlx" />
        <el-table-column fixed="right" label="操作" width="200">
          <template slot-scope="scope">
            <el-button type="success" plain size="mini" @click="handlexzfj(scope.row)" :disabled="!scope.row.wjdz" >下载附件</el-button>
            <el-button type="success" plain size="mini" @click="yul(scope.row)" :disabled="!(scope.row.wjdz.split('.')[1] == 'png' || scope.row.wjdz.split('.')[1] == 'jpg' || scope.row.wjdz.split('.')[1] == 'jpeg')" >预览</el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
    <el-dialog title="查看流程" :visible.sync="dialogFlowerTable"  @closed="dialogFlowerTable=false">
      <el-table height="600" border :data="flowerList" :header-cell-style="{ backgroundColor: 'rgb(237 237 237)'}">
        <el-table-column label="案件类别" prop="lb" hidden/>
        <el-table-column label="审批环节" prop="ajlx" />
        <el-table-column label="审批意见" prop="spyj" width="200"/>
        <el-table-column label="审批人" prop="spr" />
        <el-table-column label="审批人职务" prop="sprzw" width="100"/>
        <el-table-column label="审批单位" prop="spdw" width="200"/>
        <el-table-column label="审批时间" prop="spsj" width="180"/>
      </el-table>
    </el-dialog>
    <el-dialog :title="title" :visible.sync="dialogShenHe">
      <div style="display: flex;align-items: stretch;justify-content: space-evenly;flex-direction: column;height: 220px;">

        <div style="display: flex;align-items: center;justify-content: center;">
        <div>审批意见:</div>
        <el-input v-model="spyj" style="width: 85%;" :rows="5" type="textarea"></el-input>
      </div>
      <div style="display: flex;align-items: center;justify-content: center;">
        <div style="margin-left: 11px;">审批人:</div>
        <el-input v-model="spr" style="width: 40%;" :rows="5" type="text"></el-input>
        <div style="margin-left: 11px;">职务:</div>
        <el-select v-model="sprzw" style="width: 40%;" :rows="5" type="text"  clearable  placeholder="请选择职务">
          <el-option
        v-for="item in dict.type.sys_sprzw"
        :key="item.value"
        :label="item.label"
        :value="item.label"
      />
          </el-select>    
    </div>  
      </div>
      <div style="display: flex;align-items: center;justify-content: center;" v-if="title === '审核通过'">
        <Upload v-model="form.files" :data="{}" acceptTip="*仅图片、PDF类型文件可在线预览"
          multiple></Upload>        
        </div>
      <!-- <el-form ref="forms">
        <el-form-item label="附件选择" prop="files">
        <Upload style="width: 250px;" v-model="form.files" :data="{}" 
           multiple></Upload>
      </el-form-item>
      </el-form> -->   
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="dialogShenHe=false">取 消</el-button>
      </div>
    </el-dialog>

    <el-dialog :title="tit" :visible.sync="open" width="80%" @closed="gb">
      <el-form ref="form"  :model="form" :rules="ruless" label-width="auto" :hide-required-asterisk="true" class="creation demo-form-inline">
        <el-row :gutter="20">
          <el-col :span="24">

          <el-divider content-position="center">案件信息</el-divider>
          </el-col>
        <el-col :span="12" >
        <el-form-item label="案件编号" prop="ajbh">
          <el-input v-model="form.ajbh" placeholder="请输入案件编号" style="width: 100%":disabled="true"/>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="案件名称" prop="ajmc">
          <el-input v-model="form.ajmc" placeholder="请输入案件名称" style="width: 100%":disabled="true"/>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="案件性质" prop="ajxz" style="width: 100%">
          <el-input v-model="form.ajxz" placeholder="请输入案件性质" style="width: 100%":disabled="true"/>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="决定文书号" prop="sqwsh">
          <el-input v-model="form.sqwsh" placeholder="请输入决定文书号" style="width: 100%" :disabled="true"/>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="办案人" prop="bar">
          <el-input v-model="form.bar" placeholder="请输入办案人" style="width: 100%" :disabled="true"/>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="办案人联系电话" prop="sq_barlxdh">
          <el-input v-model="form.sq_barlxdh" placeholder="请输入办案人联系电话" style="width: 100%" :disabled="true"/>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="办案单位" prop="badw">
          <el-select v-model="form.badw" placeholder="请选择办案单位" style="width: 100%" :disabled="true">
            <el-option 
            v-for="item in options"
              :key="item.id" 
              :label="item.name" 
              :value="item.name"/>
          </el-select>
        </el-form-item>
      </el-col>
      <el-col :span="24">
      <el-divider content-position="center">个人信息</el-divider>
      </el-col>
      <el-col :span="12">
        <el-form-item label="被取保候审人(被行政拘留人)" prop="hsr">
          <el-input  v-model="form.hsr" placeholder="请输入被取保候审人(被行政拘留人)" style="width: 100%" :disabled="true"/>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="人员类别" prop="xjr">
          <el-input  v-model="form.xjr" style="width: 100%" :disabled="true"/>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="身份证号" prop="sfzh">
          <el-input v-model="form.sfzh" placeholder="请输入身份证号" style="width: 100%" :disabled="true"/>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="护照号" prop="hsrhz">
          <el-input v-model="form.hsrhz" placeholder="请输入护照号" style="width: 100%" :disabled="true"/>
        </el-form-item>
      </el-col>
     <el-col :span="12">
        <el-form-item label="性别" prop="xb">
          <el-input v-model="form.xb"  style="width: 100%" :disabled="true"/>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="地址" prop="hjdz">
          <el-input v-model="form.hjdz" placeholder="请输入户籍地址" style="width: 100%" :disabled="true"/>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="出生日期" prop="csrq">
          <el-input v-model="form.csrq" placeholder="请输入户籍地址" style="width: 100%" :disabled="true"/>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="联系电话" prop="lxdh">
          <el-input v-model="form.lxdh" placeholder="请输入联系电话" style="width: 100%" :disabled="true"/>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="委托交款人" prop="jkr">
          <el-input  v-model="form.jkr" placeholder="请输入委托交款人" style="width: 100%" :disabled="true"/>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="委托交款人身份证号" prop="jkrsfz">
          <el-input  v-model="form.jkrsfz" placeholder="请输入委托交款人身份证号" style="width: 100%" :disabled="true"/>
        </el-form-item>
      </el-col>
      <el-col :span="24">
      <el-divider content-position="center">缴款信息</el-divider>
    </el-col>
      <el-col :span="12">
        <el-form-item label="保证金金额" prop="sqje" class="form-item" style="font-size: 18px;">
          <el-input v-model="form.sqje" placeholder="请输入保证金金额" style="width: 100%" :disabled="true"/>
        </el-form-item>
      </el-col>
    <el-col :span="12">
        <el-form-item label="收取方式" prop="sqfs">
          <el-input v-model="form.sqfs" placeholder="请输入缴款人账户名称" style="width: 100%" :disabled="true"/>
        </el-form-item>
      </el-col>
    <el-col :span="12">
        <el-form-item label="缴款人账户名称" prop="dsyhbh">
          <el-input v-model="form.dsyhbh" placeholder="请输入缴款人账户名称" style="width: 100%" :disabled="true"/>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="缴款人开户行" prop="jnkhh">
          <el-input v-model="form.jnkhh" placeholder="请输入缴款人开户行" style="width: 100%" :disabled="true"/>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="缴款人账户卡号" prop="jnkh">
          <el-input v-model="form.jnkh" placeholder="请输入缴款人账户卡号" style="width: 100%" :disabled="true"/>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="批准日期" prop="pzsj">
          <el-date-picker clearable v-model="form.pzsj" type="date" value-format="yyyy-MM-dd"  
            placeholder="请选择批准时间" style="width: 100%"  :disabled="true"></el-date-picker>
        </el-form-item>
      </el-col>
      <el-col :span="12">
        <el-form-item label="填报时间" prop="sqtfsj">
          <el-date-picker clearable v-model="form.sqtfsj" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" 
            :disabled="true" placeholder="请选择填报时间" style="width: 100%" ></el-date-picker>
        </el-form-item>
      </el-col>
      </el-row>
      </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="success" plain icon="el-icon-success" :disabled="!form.ajmc" @click="handleSuccess" >通过</el-button>
      <el-button type="danger"  plain icon="el-icon-error" :disabled="!form.ajmc" @click="handleBack" >退回</el-button>
      <!-- <el-button type="primary" plain icon="el-icon-upload" :disabled="!form.xh" @click="handleYwbj">业务办结</el-button> -->
      <el-button type="warning" @click="handleckfj(form)">查看附件</el-button>
      <el-button type="primary" @click="handlecklc(form)" >查看流程</el-button>
      <el-button @click="cancel">取 消</el-button>
    </div>
  </el-dialog>

  </div>
</template>
  
<script>
import { mssh, listBzjtable, downLoadFile, getFileTableList, getFjList ,getListByXhDetail,Ywbj,sqsh} from "@/api/system/bzjtable";
import selectMultiple from '@/views/collect/addSecurity/selectMultiple'
import Upload from './DzpjUpload'
import Print from '@/utils/print.js'
import { shBack } from "../../../api/system/bzjtable";
import { tansParams, blobValidate } from "@/utils/ruoyi";

import XLSX from 'xlsx';//引入
import { saveAs } from 'file-saver'
import pdf from "vue-pdf"
export default {
  name: "Bzjtable",
  dicts: ['sys_type','sys_sprzw'],
  data() {
    return {
      flowerList:[],
      dialogFlowerTable:false,
      spyj:'',
      spr:'',
      sprzw:'',
      title:'',
      dialogShenHe:false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      fileList: [],
      directoryList: [],
      fileTableList: [],
      clickedRowData: null,
      pdfs: false,
      isShow: false,
      dialogFormVisible: false,
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 【请填写功能名称】表格数据
      bzjtableList: [],
      // 弹出层标题
      tit: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        sqshzt: '1',
        hsr: null,
        ajbh:null
      },
      pdfUrl: '',
      // formInfo: {},
      wjdz: '',
      // 表单参数
      form: {
      },
      currentIndex: '',
      options: [{
          msshzt: '1',
        label: '待审核'
      }, {
          msshzt: '5',
        label: '待办结'
      }],
      msshzt: '',
    };
  },
  components: {
    selectMultiple,
    Upload,
    pdf
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询【请填写功能名称】列表 */
    getList() {
      this.loading = true;
      listBzjtable(this.queryParams).then(response => {
        response.rows.forEach((item, index) => {
          item.pIndex = index + 1
        })
        this.bzjtableList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.getList();
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        xh: null,
        ajbh: null,
        ajmc: null,
        sqwsh: null,
        hsr: null,
        xjr: null,
        xb: null,
        csrq: null,
        zz: null,
        hjdz: null,
        dwzw: null,
        lxdh: null,
        sfzh: null,
        ajxz: null,
        sqje: null,
        sqfs: null,
        sqzt: null,
        jkr: null,
        jkrsfz: null,
        dsyhbh: null,
        jnsj: null,
        jnkh: null,
        pzr: null,
        pzsj: null,
        bar: null,
        dwbh: null,
        badw: null,
        sqrq: null,
        msje: null,
        mszt: null,
        msyy: null,
        mswsh: null,
        mspzr: null,
        mspzsj: null,
        mstfr: null,
        msrq: null,
        mstfsj: null,
        msshzt: null,
        mskhzt: null,
        mskhsj: null,
        mskhczr: null,
        thje: null,
        thfs: null,
        thzt: null,
        thrq: null,
        thwsh: null,
        thpzr: null,
        thtfsj: null,
        thshzt: null,
        thshr: null,
        thshsj: null,
        thxm: null,
        thzh: null,
        thkhh: null,
        djzt: null,
        sqdyzt: null,
        djsj: null,
        sqkpzt: null,
        thkpzt: null,
        hbwsh: null,
        hbdw: null,
        hbje: null,
        hbry: null,
        hbrq: null,
        hblxdh: null,
        hbsj: null,
        hbczy: null
      };
      this.resetForm("forms");
    },
    tableRowClassName({ row, column, rowIndex, columnIndex }) {
      //逻辑判断决定是否修改样式，如果分组一致则使用同一个样式
      return row.pIndex == this.currentIndex ? 'hover-bg' : ''
    },
    tableCurrentChange(row) {
      // this.form = row
      // this.queryParams.xh = row.xh
      // this.wjdz = row.wjdz
      // this.currentIndex = row?.pIndex
      // this.$forceUpdate()
    },
    /** 搜索按钮操作 */
    handleQuery() {
      // let ogj = {}
      // ogj.xh = this.queryParams.xh
      // ogj.msshzt = this.queryParams.msshzt


      this.queryParams.pageNum = 1
      this.getList()
    },
    handleSuccess() {
      const CANNOT_COMPLETE =this.form.sqshzt
      if (CANNOT_COMPLETE === "2") {  
        return this.$message.error('当前业务不可审核')
      }else{
        this.title = '审核通过'
      this.dialogShenHe = true
      }
    },
    // handleYwbj(){
    //   debugger
    //   const CANNOT_COMPLETE =this.form.msshzt
    //   if (CANNOT_COMPLETE === "1" || CANNOT_COMPLETE === "4") {  
    //     return this.$message.error('当前业务不可办结')
    //   }else{
    //   let ogj = {}
    //   ogj.xh = this.form.xh
    //   ogj.ajmc = this.form.ajmc
    //   ogj.ajbh = this.form.ajbh
    //   Ywbj(ogj).then(() => {
    //     this.$modal.msgSuccess("业务已办结")
    //     this.open=false
    //     this.getList()
    //     })
    //   }
    // },
    submitForm() { 
      if(!this.spyj){
        return this.$message.error('请输入审核意见')
      }
      if(!this.spr){
        return this.$message.error('请输入审核人')
      }
      if(!this.sprzw){
        return this.$message.error('请选择审批人职务')
      }
      this.form.files.forEach((item)=>{
        item.wjlx = item.fileType
        console.log(item.fileType)
      })

      this.form.spyj = this.spyj
      this.form.spr = this.spr
      this.form.sprzw = this.sprzw
      this.form.sqshzt = this.title == "审核通过"?2:3
      sqsh(this.form).then(() => {
        this.$modal.msgSuccess(this.title == "审核通过"?"审核通过":'审核退回')
        this.getList()
      // })
          this.dialogShenHe = false
          this.open=false
          this.getList()
        })
    },
    handleBack() {
      const CANNOT_COMPLETE =this.form.msshzt
      if (CANNOT_COMPLETE === "5") {  
        return this.$message.error('当前业务不可退回')
      }else{
      this.title = '审核退回'
      this.dialogShenHe = true
      }
    },
    yul(val) {
      downLoadFile({ wjdz: val.wjdz }).then(async (data) => {
        // if (this.wjdz && this.wjdz.split('.')[1] == 'png' || this.wjdz &&this.wjdz.split('.')[1] == 'jpg' || this.wjdz.split('.')[1] == 'jpeg') {
          const url = window.URL.createObjectURL(data);
          this.pdfUrl = url;//直接用iframe标签
          this.pdfs = true
        // }
      })
    },
    handleckfj(row) {
      this.dialogFormVisible = true
      getFjList({ xh: row.xh }).then((res) => {
        this.fileList = res.rows
        // this.fileList.forEach((item) => {
        //   item.typeName = this.dict.type.sys_type.filter((e)=>item.wjlx==e.value)[0].label
        // })
      })

    },
    handlecklc(row) {
      this.dialogFlowerTable = true
      getListByXhDetail(row.xh,1).then((res) => {
        this.flowerList = res.rows
      })
    },
    handlexzfj(val) {
      // this.download('/confiscate/forfeitureOfDeposit/downLoadFile', { wjdz: this.form.wjdz }, `role_${new Date().getTime()}.png`)
      downLoadFile({ wjdz: val.wjdz }).then(async (data) => {
        this.$modal.msgSuccess("下载成功");
        const url = window.URL.createObjectURL(data);
        this.pdfUrl = url;//直接用iframe标签
        const isBlob = blobValidate(data);
        if (val.wjdz && val.wjdz.split('.')[1] == 'png' || val.wjdz &&val.wjdz.split('.')[1] == 'jpg' || val.wjdz &&val.wjdz.split('.')[1] == 'jpeg') {
          if (isBlob) {
            const blob = new Blob([data])
            saveAs(blob, `role_${new Date().getTime()}.png`)
          } else {
            const resText = await data.text();
            const rspObj = JSON.parse(resText);
            const errMsg = errorCode[rspObj.code] || rspObj.msg || errorCode['default']
            Message.error(errMsg);
          }
        } else if (val.wjdz &&val.wjdz.split('.')[1] == 'pdf') {
          // let pdfUrl = window.URL.createObjectURL(new Blob([data], { type: "application/pdf" }));
          // window.open(pdfUrl)
          let blob = new Blob([data], { type: 'application/pdf' });
          let downloadElement = document.createElement("a");
          let href = window.URL.createObjectURL(blob); //创建下载的链接
          downloadElement.href = href;
          downloadElement.download = `pdf下载`    //下载后的文件名，根据需求定义
          document.body.appendChild(downloadElement);
          downloadElement.click(); //点击下载
          document.body.removeChild(downloadElement); //下载完成移除元素
          window.URL.revokeObjectURL(href); //释放掉blob对象
        } else {
          const blob = new Blob([data], { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' }) // response就是接口返回的文件流
          const objectUrl = URL.createObjectURL(blob)
          const a = document.createElement('a') // 创建a标签
          a.href = objectUrl
          a.download = 'excel下载' // 自定义文件名
          a.click() // 下载文件
          window.URL.revokeObjectURL(objectUrl) // 释放内存
          // link.remove()
        }
        this.dialogFormVisible = false
      })
    },
    /**双击操作 */
    doubleclick(row,event){
    this.form = row;
    this.open = true;
  },
    /** 重置按钮操作 */
    resetQuery() {
      this.queryParams.hsr = ''
      this.queryParams.ajbh = ''
      this.queryParams.sqshzt = '1'
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.xh)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
  }
};
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
.creation {
  .el-form-item {
    margin-bottom: 15px;
  }

  ::v-deep.el-input__inner {
    width: 250px;
  }

  // .xx {
  //   ::v-deep.el-input__inner {
  //     width: 630px;
  //   }
  // }
}

::v-deep .el-table__body-wrapper::-webkit-srollbar-track {
  background-color: rgba(255, 255, 255, 0);
}

//可设置胶囊宽高
::v-deep .el-table__body-wrapper::-webkit-scrollbar {
  height: 12px;
  width: 10px;
  opacity: 0.5;
}

// 设置胶囊色
::v-deep .el-table__body-wrapper::-webkit-scrollbar-thumb {
  border-radius: 15px;
  background-color: #cdd9e6;
}

::v-deep .el-table__body .el-table__row.hover-bg td {
  background-color: #cde6f7 !important;
}
</style>